//
// Created by Castle on 2025/10/28.
//

#include <iostream>
using namespace std;

int main() {

    // Declare pointer and reference
    double double_value {1.234};
    double& ref_double_value {double_value};    // reference to double_value
    double* p_double_value {&double_value};     // pointer to double_value

    // reading
    cout << "double_value = " << double_value << endl;
    cout << "ref_double_value = " << ref_double_value << endl;
    cout << "p_double_value = " << p_double_value << endl;
    cout << "*p_double_value = " << *p_double_value << endl;

    // writting through pointer
    *p_double_value = 14.33;
    cout << endl;
    cout << "double_value = " << double_value << endl;
    cout << "ref_double_value = " << ref_double_value << endl;
    cout << "p_double_value = " << p_double_value << endl;
    cout << "*p_double_value = " << *p_double_value << endl;

    // Writting through reference
    ref_double_value = 19.33;
    cout << endl;
    cout << "double_value = " << double_value << endl;
    cout << "ref_double_value = " << ref_double_value << endl;
    cout << "p_double_value = " << p_double_value << endl;
    cout << "*p_double_value = " << *p_double_value << endl;



    return 0;
}